package main

import (
	"github.com/gin-gonic/gin"
	"github.com/thinkerou/favicon"
	"nood/app/cache/noodredis"
	"nood/app/model"
	"nood/app/router/httprouter"
	"nood/app/router/wsrouter"
	"nood/noodframe"
	"nood/noodframe/noodconf"
	"nood/noodframe/noodlog"
	"nood/noodframe/noodws"
)

func main() {
	noodconf.NewConf() //读取配置信息
	noodlog.NewZap()   //注册日志功能
	noodredis.New()    //注册redis
	model.NewDB()      //注册GORM2

	service := gin.Default()
	service.Use(favicon.New("app/favicon.ico"))
	service.LoadHTMLGlob("app/view/*")
	httprouter.Init(service)        //注册http路由
	wsrouter.Init()                 //注册ws路由
	go noodws.WebSocketRun(service) //注册WebSocket
	go noodws.PushToClient()        //注册推送服务
	noodframe.Run(service)
}
